package com.infore.airsupervise.bean;

import android.content.Context;
import android.content.SharedPreferences;

import com.alibaba.fastjson.JSON;
import com.infore.airsupervise.app.Constants;
import com.infore.airsupervise.app.MyApplication;

import java.util.List;

/**
 * @features:  网格实体类
 * @author: WuTao
 * @date: 2017/3/20 11:09
 */
public class StationGridE {

    /**
     * psonName :
     * bh : 440604010012
     * name : 丽银社区居委会
     * psonId :
     * id : 0587b9f9dde74603937fc97d58c4d1a2
     * fbh : 440604010000
     */

    private String psonName;
    private String bh;
    private String name;
    private String psonId;
    private String id;
    private String fbh;
    private List<StationGridE> beanList;

    public List<StationGridE> getBeanList() {
        return beanList;
    }

    public void setBeanList(List<StationGridE> beanList) {
        this.beanList = beanList;
    }

    public String getPsonName() {
        return psonName;
    }

    public void setPsonName(String psonName) {
        this.psonName = psonName;
    }

    public String getBh() {
        return bh;
    }

    public void setBh(String bh) {
        this.bh = bh;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPsonId() {
        return psonId;
    }

    public void setPsonId(String psonId) {
        this.psonId = psonId;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getFbh() {
        return fbh;
    }

    public void setFbh(String fbh) {
        this.fbh = fbh;
    }

    /**
     * 保存网格列表信息
     */
    public static void saveGridList(StationGridE gridE){
        SharedPreferences sp = MyApplication.getInstance().getSharedPreferences(Constants.SP_FILE_GRID, Context.MODE_PRIVATE);
        String str_grid = JSON.toJSONString(gridE);
        sp.edit().putString(Constants.SP_ALLGRID_KEY,str_grid).commit();
    }

    /**
     * 获取网格列表信息
     */
    public static StationGridE getGridList(){
        SharedPreferences sp = MyApplication.getInstance().getSharedPreferences(Constants.SP_FILE_GRID, Context.MODE_PRIVATE);
        String str_grid = sp.getString(Constants.SP_ALLGRID_KEY,"");
        StationGridE gridE = JSON.parseObject(str_grid,StationGridE.class);
        return  gridE;
    }
}
